package pojo;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import component.MyJsonSeriallizer;

@Entity
@GenericGenerator(strategy="uuid",name="uuid_food")
public class Food {
	@Id
	@GeneratedValue(generator="uuid_food")
	private String id;
	private String name;
	private double price;
	@JsonSerialize(using=MyJsonSeriallizer.class)
	private String image;
	
	@ManyToOne
	@JoinColumn(name="m_id")
	@JsonBackReference
	private Merchant merchant;
	
	@ManyToOne
	@JoinColumn(name="c_id")
	@JsonBackReference
	private Categories categories;

	public Food() {
		super();
	}

	
	public Food(String id, String name, double price, String image) {
		super();
		this.id = id;
		this.name = name;
		this.price = price;
		this.image = image;
	}


	public Food(String id, String name, double price, String image,
			Merchant merchant, Categories categories) {
		super();
		this.id = id;
		this.name = name;
		this.price = price;
		this.image = image;
		this.merchant = merchant;
		this.categories = categories;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

	public Categories getCategories() {
		return categories;
	}

	public void setCategories(Categories categories) {
		this.categories = categories;
	}
	
}
